package hello;

import java.util.Arrays;

public class Case5 {
    public static void main(String[] args) {
        int[] arr = {10, 20, 30, 40, 50};
//        int[] newarr = Arrays.copyOf(arr,4);
//        for (int i = 0; i < newarr.length; i++) {
//            System.out.println(newarr[i]);
//        }
        int index = Arrays.binarySearch(arr, 30);
        System.out.println(index);
        int[] newarr2 = Arrays.copyOfRange(arr, 0, 5);
        for (int i = 0; i < newarr2.length; i++) {
            System.out.println(newarr2[i]);
        }
    }
}
